/*
 * Created by 2006-4-3 22:08:20
 * $Id: JspSnippetDispatchServlet.java 76 2006-07-06 17:03:18Z wjx $
 */
package com.someok.web.servlet;

import org.apache.log4j.Logger;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.someok.base.Config;

/**
 *
 * <p><a href="SnippetJspDispatchServlet.java.html"><i>View Source</i></a></p>
 *
 * @author wjx
 * @version $Revision: 76 $ $Date: 2006-07-07 01:03:18 +0800 (星期五, 07 七月 2006) $
 *
 * @web.servlet name = "Jsp Snippet Dispatcher Servlet"
 * @web.servlet-mapping url-pattern = "/jspSnippetDispatch"
 */
public class JspSnippetDispatchServlet extends BaseServlet {
	private static final Logger logger = Logger
			.getLogger(JspSnippetDispatchServlet.class);

	private static final long serialVersionUID = -3584772955328276768L;

	protected String outputPageBody(HttpServletRequest request, HttpServletResponse response) {
		String snippetId = request.getParameter("snippetType");
		String snippetJsp = Config.getInstance().getString("snippet." + snippetId);
		logger.debug(snippetId + ", " + snippetJsp);

		try {
			request.getRequestDispatcher(snippetJsp).forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
